
// 这段代码实现了动态创建script标签,然后插入到head标签中.然后当js加载完毕的时候调用 在调用 动态添加 另一个 JS文件 也可以是 之前加载完成后 里面的方法 变量等

function createdScript(url) {
  var head = document.getElementsByTagName('head')[0]
  var script = document.createElement('script')
  script.type = 'text/javascript'
  script.src = process.env.BASE_API + url
  head.appendChild(script)
  return script
}

var url = '/front/js/common.js?v=' + Date.parse(new Date())
var sc = createdScript(url)
sc.onload = sc.onreadystatechange = function() {
  if (!this.readyState || this.readyState === 'loaded' || this.readyState === 'complete') {
    var version = Bank.dictionaryDataVersion
    var baseUrl = `/front/js/dictionaryData.js?data=${version}`
    createdScript(baseUrl)
    sc.onload = sc.onreadystatechange = null
  }
}
